package csc.fresher.controller;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import csc.fresher.dao.UserInfoDAO;
import csc.fresher.domain.History;
import csc.fresher.domain.UserInfo;

/**
 * 
 * Go to Login page and handler event about login
 *
 */
@Controller
@RequestMapping(value="/login")
public class LoginController {
	
	/**
	 * Go to Login page or handler login failed
	 * @param loginfailed
	 * @param model
	 * @return
	 */
	@RequestMapping
	public String goPage(@RequestParam(value="loginfailed", required=false) String loginfailed, Model model){
		if (loginfailed != null) {
			model.addAttribute("message", "Invalid username or password OR Account is not active");
		}

		return "login";
	}
}
